﻿using LNet;
using OestsCommon.Model;
using OestsServer.Managers;
using OestsServer.Net;

namespace OestsServer.Handlers.OESPHandlers
{
    /// <summary>
    /// 退出登录，但是还在连接状态
    /// </summary>
    public class ExitOespHandler : HandlerBase<OESPClientChannel>
    {
        public override PacketKey PKey
        {
            get
            {
                return PacketKey.Exit;
            }
        }
        public override void Execute(OESPClientChannel client, Request packet)
        {
            //如果是学生退出，
            if (client.User is Student)
            {
                Student st = client.User as Student;

                st.OnLine = false;
                TeacherManager.Instance.NotifyTeacherStOnlineState(st);//通知管理教员下线
            }
            client.User.DBid = -1;
            client.Send(ResponsePacket);
        }

    }

}
